package com.server.llh.llhserverwork.app;

import android.app.Activity;

import com.baidu.mapapi.SDKInitializer;
import com.lelaohui.net.LeLaoHuiApplication;
import com.tencent.bugly.Bugly;
import com.tencent.bugly.crashreport.CrashReport;

import java.util.LinkedList;
import java.util.List;

import baidu.location.service.view.LocationService;


/**
 * Created by T460p on 2017/3/15.
 */

public class LelaohuirelativesApp extends LeLaoHuiApplication {
    public LocationService locationService;
    private static List<Activity> activityList = new LinkedList<Activity>();

    @Override
    public void onCreate() {
        //Bugly 初始化
//        CrashReport.initCrashReport(getApplicationContext(), "38bb589009", false);
        Bugly.init(getApplicationContext(), "38bb589009", false);
        lelaohuirelativesApp=this;
        /***
         * 初始化定位sdk，建议在Application中创建
         */
        locationService = new LocationService(getApplicationContext());
        SDKInitializer.initialize(getApplicationContext());
        super.onCreate();
    }
    public static LelaohuirelativesApp getContext(){
        return lelaohuirelativesApp;
    }

    public static LelaohuirelativesApp lelaohuirelativesApp;
    public static LelaohuirelativesApp getLelaohuirelativesApp(){
        return lelaohuirelativesApp;
    }
    // 添加Activity到容器中
    public static void addActivity(Activity activity) {
        activityList.add(activity);
    }

    // 遍历所有Activity并finish

    public static void exit() {
        for (Activity activity : activityList) {
            activity.finish();
        }
        System.exit(0);

    }
}
